$(document).ready(function(){
	access_token = $.getCookie("access_token");
	var isClick = 0;
	//拉起支付
	$.prepaid = function(amount){
			            //获取支付JSON数据
			            $.getJSON("/"+server+"/chargeCreate?access_token="+access_token+"&channel=wx_pub&amount="+amount+requestLast,function(json){
									$.popTagShow(2,'正在充值','正在充值请稍后',null,null,null,null,null,null);	
				                    pingpp.createPayment(json, function(result, err) {
				                    	if(result == "success"){
				                    		$.popTagShow(1,"充值成功","请查看账户",null,null,null,null,"确定",$.popTagHide);
							    		}
									    else if (result == "fail") {
											$.popTagShow(1,"充值失败","请重试",null,null,null,null,"确定",$.popTagHide);				    			    	
									    } 
									    else if (result == "cancel") {
									    	$.popTagShow(1,"取消充值","你取消了充值",null,null,null,null,"确定",$.popTagHide);	
									    }						    					                        
				                    });	
				                   	
			           });	
	}	

	$.reloadIsClick = function(){
		isClick = 0;
	}
	//点击充值10块钱
	$('.charge1').click(function(){
		if(isClick == 0){
			isClick = 1;
			$.prepaid(1000);
			setTimeout("$.reloadIsClick()",2000);
		}
	})	
	//点击充值50块钱
	$('.charge2').click(function(){
		if(isClick == 0){
			isClick = 1;
			$.prepaid(5000);
			setTimeout("$.reloadIsClick()",2000);
		}
	})
	//点击充值100块钱
	$('.charge3').click(function(){
		if(isClick == 0){
			isClick = 1;
			$.prepaid(10000);
			setTimeout("$.reloadIsClick()",2000);
		}
	})

})